/* @(#)GSBalanceParamDAO.java   
 *
 * Project: GS
 *
 * Modify Information:
 * =============================================================================
 *   Author       Date       Description
 *   ------------ ---------- ---------------------------------------------------
 *   Jenny Li    2006-4-20     新增
 *
 * Copyright Notice:
 * =============================================================================
 *    Copyright (c) 2001-2006 Beijing HiTRUST Technology Co., Ltd. 1808 Room, 
 *        Science & Technology Building, No. 9 South Street, Zhong Guan Cun, 
 *        Haidian District, Beijing ,100081, China All rights reserved.
 *
 *    This software is the confidential and proprietary information of
 *        Beijing HiTRUST Technology Co., Ltd. ("Confidential Information").
 *        You shall not disclose such Confidential Information and shall use it
 *        only in accordance with the terms of the license agreement you entered
 *        into with HiTRUST.
 *
 * Warning:
 * =============================================================================
 * 
 */
package com.hitrust.gs.dao;

import java.util.ArrayList;

import com.hitrust.gs.bean.GSBalanceParamBean;
import com.hitrust.gs.lib.GSLogWriter;
import com.hitrust.gs.lib.db.GSBaseDAO;
import com.hitrust.gs.util.exception.GSException;

/**
 * 
 */
public class GSBalanceParamDAO extends GSBaseDAO {
    
    public GSBalanceParamBean queryBalanceDate() throws GSException{
        String tSql = "select * from GS_BALANCE_PARAM";
        GSBalanceParamBean tBean = new GSBalanceParamBean();
        try{
            ArrayList tList = this.executeQuery(tBean,tSql,null);
            if(tList.size() == 1){
                tBean = (GSBalanceParamBean)tList.get(0);
            }
        }catch(Exception e){
            GSLogWriter.error(this,e.toString());
            throw new GSException(GSException.E00001,GSException.E00001_MSG);
        }
        return tBean;
    }
    
    public void saveBalanceParam(GSBalanceParamBean tBean) throws GSException {
        String sql = "update gs_balance_param set " +
        		"GS_BALANCE_DATE_TYPE=?, GS_BALANCE_START_DATE=?, GS_BALANCE_END_DATE=?, " +
        		"GS_BALANCE_PERIOD=?, GS_OPERATOR_ID=?, GS_OPERATE_DATE=? ";
        Object[] obj = new Object[]{tBean.getGs_balance_date_type(),tBean.getGs_balance_start_date(),
                tBean.getGs_balance_end_date(),tBean.getGs_balance_period(),tBean.getGs_operator_id(),
                tBean.getGs_operate_date()};
        try{
        this.executeUpdate(sql,obj);
        }catch(Exception e){
            throw new GSException (GSException.E90000,GSException.E90000_MSG);
        }
        
    }
}
